package edu.nf.supermarket.service.impl;

import edu.nf.supermarket.entity.Address;
import edu.nf.supermarket.mapper.AddressMapper;
import edu.nf.supermarket.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yjj
 * @date 2025-05-21
 */
@Service("addressService")
public class AddressServiceImpl implements AddressService {
    @Autowired
    private AddressMapper addressMapper;
    @Override
    public void addAddress(Address address, Integer userId) {
        addressMapper.addAddress(address,userId);
    }

    @Override
    public void updateAddress(Address address) {
        addressMapper.updateAddress(address);

    }

    @Override
    public void deleteAddress(Integer addressId) {
        addressMapper.deleteAddress(addressId);
    }

    @Override
    public List<Address> findAllAddress(Integer userId) {
        return addressMapper.findAllAddress(userId);
    }

    @Override
    public void defaultAddress(Integer userId) {
        addressMapper.defaultAddress(userId);
    }

    @Override
    public void setDefault(Integer userId, Integer addressId) {
        addressMapper.setDefault(userId,addressId);
    }
}
